/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Utilities;

import DataModel.Enums;

/**
 *
 * @author Rainiero
 */
public class EnumConverter {

    // <editor-fold defaultstate="collapsed" desc="Project state">
    private static Enums.ProjectState[] states = new Enums.ProjectState[]
    {
        Enums.ProjectState.incomplete,
        Enums.ProjectState.approved,
        Enums.ProjectState.rejected,
        Enums.ProjectState.onRequest,
        Enums.ProjectState.cancelled,
        Enums.ProjectState.finished,
        Enums.ProjectState.onGoing
    };

    private static String[] stateNames = new String[]
    {
        "Solicitud Incompleta",
        "Solicitud Aprobada",
        "Solicitud Rechazada",
        "Solicitud Pendiente",
        "Proyecto Cancelado",
        "Proyecto Terminado",
        "Proyecto en Progreso"
    };

    public static Enums.ProjectState GetProjectStateFromString(String projectState)
    {
        return states[GeneralUtilities.GetIndex(stateNames, projectState)];
    }

    public static String GetEnumName(Enums.ProjectState projectState)
    {
        return stateNames[GeneralUtilities.GetIndex(states, projectState)];
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Project Type">
    private static Enums.ProjectType[] types = new Enums.ProjectType[]
    {
        Enums.ProjectType.Project,
        Enums.ProjectType.Request
    };

    private static String[] typeNames = new String[]
    {
        "Proyecto",
        "Solicitud"
    };

    public static Enums.ProjectType GetProjectTypeFromString(String projectType)
    {
        return types[GeneralUtilities.GetIndex(typeNames, projectType)];
    }

    public static String GetEnumName(Enums.ProjectType projectType)
    {
        return typeNames[GeneralUtilities.GetIndex(types, projectType)];
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="User roles">
    private static Enums.UserRole[] roles = new Enums.UserRole[]
    {
        Enums.UserRole.ProjectRisponsible,
        Enums.UserRole.ProjectOfficial,
        Enums.UserRole.AmdSuperior
    };

    private static String[] roleNames = new String[]
    {
        "Responsable de proyecto",
        "Oficial de proyecto",
        "Superior AMD"
    };

    public static Enums.UserRole GetUserRoleFromString(String userRole)
    {
        return roles[GeneralUtilities.GetIndex(roleNames, userRole)];
    }

    public static String GetEnumName(Enums.UserRole userRole)
    {
        return roleNames[GeneralUtilities.GetIndex(roles, userRole)];
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Payment status">
    private static Enums.PaymentStatus[] payStatus = new Enums.PaymentStatus[]
    {
        Enums.PaymentStatus.Payed,
        Enums.PaymentStatus.Pending
    };

    private static String[] payStatusNames = new String[]
    {
        "Depositado",
        "Pendiente"
    };

    public static Enums.PaymentStatus GetPaymentStatusFromString(String status)
    {
        return payStatus[GeneralUtilities.GetIndex(payStatusNames, status)];
    }

    public static String GetEnumName(Enums.PaymentStatus status)
    {
        return payStatusNames[GeneralUtilities.GetIndex(payStatus, status)];
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Activity Status">
    private static Enums.ActivityStatus[] activityStatus = new Enums.ActivityStatus[]
    {
        Enums.ActivityStatus.NotStarted,
        Enums.ActivityStatus.InProgress,
        Enums.ActivityStatus.Finished
    };

    private static String[] activityStatusNames = new String[]
    {
        "No comenzada",
        "En progreso",
        "Terminada"
    };

    public static Enums.ActivityStatus GetActivityStatusFromString(String status)
    {
        return activityStatus[GeneralUtilities.GetIndex(activityStatusNames, status)];
    }

    public static String GetEnumName(Enums.ActivityStatus status)
    {
        return activityStatusNames[GeneralUtilities.GetIndex(activityStatus, status)];
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="User roles">
/*    private static Enums.UserRole[] roles = new Enums.UserRole[]
    {
        Enums.UserRole.ProjectRisponsible,
        Enums.UserRole.ProjectOfficial
    };

    private static String[] roleNames = new String[]
    {
        "Responsable de proyecto",
        "Oficial de proyecto"
    };

    public static Enums.UserRole GetUserRoleFromString(String userRole)
    {
        return roles[GeneralUtilities.GetIndex(roleNames, userRole)];
    }

    public static String GetEnumName(Enums.UserRole userRole)
    {
        return roleNames[GeneralUtilities.GetIndex(roles, userRole)];
    }/**/
    // </editor-fold>
}
